package com.killers.cold.exception;

/**
 * 基础异常类型
 */
public enum CommonErrorCode implements IErrorCodeType {

    /**
     * 0 成功
     */
    SUCCEED(0, "操作成功"),

    /**
     * 9999 失败
     */
    FAILED(9999, "操作失败"),

    /**
     * 1*** 用户相关业务异常
     */
    USER_NOT_FOUND(1001, "用户不存在"),
    USER_PWD_ERROR(1002, "密码不正确"),
    USER_IS_BLOCKED(1003, "用户被锁定");

    public final int code;
    public final String message;

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    CommonErrorCode(IErrorCodeType errorCodeType){
        this.code = errorCodeType.getCode();
        this.message = errorCodeType.getMessage();
    }

    CommonErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String toString() {
        return "CommonErrorCode{" +
                "code=" + code +
                ", message='" + message + '\'' +
                '}';
    }
}
